<?php

namespace app\admin\model;

use app\common\lib\Status;
use app\common\model\TimeModel;

class BuddhaBuddha extends TimeModel
{

    protected $name = "buddha_buddha";

    protected $deleteTime = "delete_time";

    public function getStatusList()
    {
        return ['0' => '禁用', '1' => '启动',];
    }

    /**
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getBuddhaByList()
    {
        return $this->where('status', Status::mysql_normal)->select()->toArray();
    }

    /**
     * @param $id
     * @return BuddhaBuddha|array|mixed|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getBuddhaByListId($id)
    {
        return $this->where('id', $id)
            ->find();
    }
}